package cate.game.play.buff.h;

import cate.common.table.d.GDBuff;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import easy.java.dev.note.NoteField;

/**
 *【冰冻】无法行动，持续2回合，受击2次后解除
 */
public class 冰冻BH extends BuffHandler {

	private int 伤害次数;

	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		伤害次数+= args.getInt("伤害次数", 0);
	}

	@NoteField("当前受到伤害次数")
	public int hurtNum;


	@Override
	public void afterSufferOneAttack(SkillActionCtx action, long totalDamage, boolean strike) {
		if (totalDamage <= 0) {
			return;
		}
		hurtNum++;
		if (hurtNum >= 伤害次数) {
			this.buff.markInvalid(action, GDBuff.InvalidReason.EXHAUSTED);
		}
	}

	@Override
	public boolean noMoveWithCtrl() {
		return true;
	}
}
